package edu.itesm.rm.controls 
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	/**
	 * ...
	 * @author Aldo Reyes
	 */
	public class SquareButton extends Sprite
	{
		
		private var _tf:TextField;
		private var _bg:Shape;
		
		public function SquareButton(label:String) 
		{
			buttonMode = true;
			mouseChildren = false;
			
			
			_tf = new TextField();
			_tf.autoSize = TextFieldAutoSize.LEFT;
			//_tf.textColor = 0xffffff;
			
			_bg = new Shape();
			_bg.graphics.beginFill(0, .7);
			_bg.graphics.lineStyle(5, 0xffffff);
			addChild(_bg);
			
			_tf.defaultTextFormat = new TextFormat(new ArialFont().fontName, 30, 0xFFFFFF);
			_tf.x = _tf.y = 5;
			_tf.embedFonts = true;
			_tf.text = label;
			addChild(_tf);
			
			_bg.graphics.drawRoundRect(0, 0, width+_tf.x*2, height+_tf.y*2, 10, 10);
			_bg.graphics.endFill();
			
		}
		
	}

}